<?php //pack11class

class AdminObjectsList extends Module {

    public $navigation="";

    public function setup() {
        $objects = ObjectsManager::getObjects(true);
        
        $objectSetting = SettingsManager::getSetting("object");
        $setting=clone $objectSetting;
        $setting->value=0;

        $queryObject=new GetQueryObject();
        $queryObject->setValue($setting, GetQueryObject::SETTING);

        $panel=new AdminObjectsListPanel();
        $panel->link=GetQuery::generate($queryObject);
        $panel->setBody(LabelManager::getLabel("add_object"));
        $this->addChild($panel);
        foreach($objects as $object) {
            $item=new AdminObjectsListItem();

            $setting=clone $objectSetting;
            $setting->value=$object->id;

            $queryObject=new GetQueryObject();
            $queryObject->setValue($setting, GetQueryObject::SETTING);

            $item->link=GetQuery::generate($queryObject);

            $item->object=$object->id;
            $item->setBody($object->getLabel());
            if(!$object->active) $item->setClass("AdminObjectsListItemDeleted");
            $this->addChild($item);
        }

       $this->navigation=Template::html(new ObjectsListNavigation);

    }

}
?>
